import threading
import time

import redis

from user.models import User


class MyRedis:

    def __init__(self, **redis_kwargs):
        self.__db = redis.Redis(**redis_kwargs)

    def set(self, key, value):
        self.__db.set(key, value)

    def get(self, key):
        return self.__db.get(key)

    def inc(self, key):
        self.__db.incrby(key, 1)

    def exp(self, key, time):
        self.__db.expire(key, time)
